<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<link rel="stylesheet" href="Public/Bootstrap/Css/bootstrap.min.css" />
	<link rel="stylesheet" href="Public/Admin/Css/common.css" />
	<script type="text/javascript" src="Public/Admin/Js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('#sort').live('blur',function(){
				$sort=$(this).val();
				$id=$(this).parents('.info').find('#id').html();
				$id=parseInt($id);
				$.ajax({
					type:"post",
					url:"./index.php?m=Admin&c=Cate&a=sort",
					data:{sort1:$sort,cid:$id},
				});
				 window.location.reload();
			})
			
		})
	</script>
</head>
<body>
	<form action="{{U('Cate/sort')}}" method="post">
		<div class="container-fluid">
			<div class="row-fluid">
				<div class="span12">
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
								<th>
									分类ID
								</th>
								<th>
									分类名称
								</th>
								<th>
									排序
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody>
						
							{{foreach from="$data"value="$v"}}
								<tr class="info">
								<td id="id">
									{{$v['cid']}}
								</td>
								<td class='open' cid='{{$v['cid']}}'>
									{{$v['cname']}}
								</td>
								</td>
								<td>
									<input type="text" name='sort' value='{{$v['sort']}}' id="sort"/>
									
								</td>
								<td>
									<a href="{{U('addSon', array('pid' => $v['cid'],'tid'=>$v['tid']))}}" class="btn btn-success"><i class="icon-edit icon-white"></i>添加子分类</a>
									<a href="{{U('edit', array('cid' => $v['cid'],'pid'=>$v['pid']))}}" class="btn btn-warning"><i class="icon-pencil icon-white"></i>修改</a>
									<a href="{{U('del', array('cid' => $v['cid']))}}" class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
								</td>
							</tr>
							{{endforeach}}
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</form>

<script type="text/javascript">
$(function(){
	$('.open').toggle(function(){
		var cid = $(this).attr('cid');
		$('tr[pid=' + cid + ']').fadeIn(600);
	}, function(){
		var cid = $(this).attr('cid');
		$('tr[pid=' + cid + ']').fadeOut(600);
	});
});
</script>
</body>
</html>